package com.hudson.common.domain;

import java.util.Objects;
import java.util.concurrent.TimeUnit;

/**
 * @Author: 渔小鲤
 * @DateTime: 2025/7/27 23:12
 **/
public class Duration {
    private  long time;
    private  TimeUnit unit;

    public Duration(long time, TimeUnit unit) {
        this.time = time;
        this.unit = unit;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public TimeUnit getUnit() {
        return unit;
    }

    public void setUnit(TimeUnit unit) {
        this.unit = unit;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Duration duration = (Duration) o;
        return time == duration.time && unit == duration.unit;
    }

    @Override
    public int hashCode() {
        return Objects.hash(time, unit);
    }
}
